﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.MaterialPropertyBlock
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngine.Bindings;
using UnityEngine.Rendering;

#nullable disable
namespace UnityEngine
{
  /// <summary>
  ///   <para>A block of material values to apply.</para>
  /// </summary>
  [NativeHeader("Runtime/Graphics/ShaderScriptBindings.h")]
  [NativeHeader("Runtime/Shaders/ShaderPropertySheet.h")]
  [NativeHeader("Runtime/Shaders/ComputeShader.h")]
  [NativeHeader("Runtime/Math/SphericalHarmonicsL2.h")]
  public sealed class MaterialPropertyBlock
  {
    internal IntPtr m_Ptr;

    [Obsolete("Use SetFloat instead (UnityUpgradable) -> SetFloat(*)", false)]
    public void AddFloat(string name, float value)
    {
      this.SetFloat(Shader.PropertyToID(name), value);
    }

    [Obsolete("Use SetFloat instead (UnityUpgradable) -> SetFloat(*)", false)]
    public void AddFloat(int nameID, float value) => this.SetFloat(nameID, value);

    [Obsolete("Use SetVector instead (UnityUpgradable) -> SetVector(*)", false)]
    public void AddVector(string name, Vector4 value)
    {
      this.SetVector(Shader.PropertyToID(name), value);
    }

    [Obsolete("Use SetVector instead (UnityUpgradable) -> SetVector(*)", false)]
    public void AddVector(int nameID, Vector4 value) => this.SetVector(nameID, value);

    [Obsolete("Use SetColor instead (UnityUpgradable) -> SetColor(*)", false)]
    public void AddColor(string name, Color value)
    {
      this.SetColor(Shader.PropertyToID(name), value);
    }

    [Obsolete("Use SetColor instead (UnityUpgradable) -> SetColor(*)", false)]
    public void AddColor(int nameID, Color value) => this.SetColor(nameID, value);

    [Obsolete("Use SetMatrix instead (UnityUpgradable) -> SetMatrix(*)", false)]
    public void AddMatrix(string name, Matrix4x4 value)
    {
      this.SetMatrix(Shader.PropertyToID(name), value);
    }

    [Obsolete("Use SetMatrix instead (UnityUpgradable) -> SetMatrix(*)", false)]
    public void AddMatrix(int nameID, Matrix4x4 value) => this.SetMatrix(nameID, value);

    [Obsolete("Use SetTexture instead (UnityUpgradable) -> SetTexture(*)", false)]
    public void AddTexture(string name, Texture value)
    {
      this.SetTexture(Shader.PropertyToID(name), value);
    }

    [Obsolete("Use SetTexture instead (UnityUpgradable) -> SetTexture(*)", false)]
    public void AddTexture(int nameID, Texture value) => this.SetTexture(nameID, value);

    [NativeName("GetIntFromScript")]
    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern int GetIntImpl(int name);

    [ThreadSafe]
    [NativeName("GetFloatFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern float GetFloatImpl(int name);

    [ThreadSafe]
    [NativeName("GetVectorFromScript")]
    private Vector4 GetVectorImpl(int name)
    {
      Vector4 ret;
      this.GetVectorImpl_Injected(name, out ret);
      return ret;
    }

    [ThreadSafe]
    [NativeName("GetColorFromScript")]
    private Color GetColorImpl(int name)
    {
      Color ret;
      this.GetColorImpl_Injected(name, out ret);
      return ret;
    }

    [ThreadSafe]
    [NativeName("GetMatrixFromScript")]
    private Matrix4x4 GetMatrixImpl(int name)
    {
      Matrix4x4 ret;
      this.GetMatrixImpl_Injected(name, out ret);
      return ret;
    }

    [ThreadSafe]
    [NativeName("GetTextureFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern Texture GetTextureImpl(int name);

    [NativeName("HasPropertyFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool HasPropertyImpl(int name);

    [NativeName("HasFloatFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool HasFloatImpl(int name);

    [NativeName("HasIntegerFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool HasIntImpl(int name);

    [NativeName("HasTextureFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool HasTextureImpl(int name);

    [NativeName("HasMatrixFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool HasMatrixImpl(int name);

    [NativeName("HasVectorFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool HasVectorImpl(int name);

    [NativeName("HasBufferFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool HasBufferImpl(int name);

    [NativeName("HasConstantBufferFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool HasConstantBufferImpl(int name);

    [NativeName("SetIntFromScript")]
    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetIntImpl(int name, int value);

    [ThreadSafe]
    [NativeName("SetFloatFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetFloatImpl(int name, float value);

    [ThreadSafe]
    [NativeName("SetVectorFromScript")]
    private void SetVectorImpl(int name, Vector4 value)
    {
      this.SetVectorImpl_Injected(name, ref value);
    }

    [NativeName("SetColorFromScript")]
    [ThreadSafe]
    private void SetColorImpl(int name, Color value) => this.SetColorImpl_Injected(name, ref value);

    [ThreadSafe]
    [NativeName("SetMatrixFromScript")]
    private void SetMatrixImpl(int name, Matrix4x4 value)
    {
      this.SetMatrixImpl_Injected(name, ref value);
    }

    [NativeName("SetTextureFromScript")]
    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetTextureImpl(int name, [NotNull("ArgumentNullException")] Texture value);

    [ThreadSafe]
    [NativeName("SetRenderTextureFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetRenderTextureImpl(
      int name,
      [NotNull("ArgumentNullException")] RenderTexture value,
      RenderTextureSubElement element);

    [ThreadSafe]
    [NativeName("SetBufferFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetBufferImpl(int name, ComputeBuffer value);

    [ThreadSafe]
    [NativeName("SetBufferFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetGraphicsBufferImpl(int name, GraphicsBuffer value);

    [NativeName("SetConstantBufferFromScript")]
    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetConstantBufferImpl(int name, ComputeBuffer value, int offset, int size);

    [NativeName("SetConstantBufferFromScript")]
    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetConstantGraphicsBufferImpl(
      int name,
      GraphicsBuffer value,
      int offset,
      int size);

    [ThreadSafe]
    [NativeName("SetFloatArrayFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetFloatArrayImpl(int name, float[] values, int count);

    [NativeName("SetVectorArrayFromScript")]
    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetVectorArrayImpl(int name, Vector4[] values, int count);

    [ThreadSafe]
    [NativeName("SetMatrixArrayFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetMatrixArrayImpl(int name, Matrix4x4[] values, int count);

    [NativeName("GetFloatArrayFromScript")]
    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern float[] GetFloatArrayImpl(int name);

    [NativeName("GetVectorArrayFromScript")]
    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern Vector4[] GetVectorArrayImpl(int name);

    [ThreadSafe]
    [NativeName("GetMatrixArrayFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern Matrix4x4[] GetMatrixArrayImpl(int name);

    [ThreadSafe]
    [NativeName("GetFloatArrayCountFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern int GetFloatArrayCountImpl(int name);

    [ThreadSafe]
    [NativeName("GetVectorArrayCountFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern int GetVectorArrayCountImpl(int name);

    [ThreadSafe]
    [NativeName("GetMatrixArrayCountFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern int GetMatrixArrayCountImpl(int name);

    [ThreadSafe]
    [NativeName("ExtractFloatArrayFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void ExtractFloatArrayImpl(int name, [Out] float[] val);

    [NativeName("ExtractVectorArrayFromScript")]
    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void ExtractVectorArrayImpl(int name, [Out] Vector4[] val);

    [NativeName("ExtractMatrixArrayFromScript")]
    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void ExtractMatrixArrayImpl(int name, [Out] Matrix4x4[] val);

    [ThreadSafe]
    [FreeFunction("ConvertAndCopySHCoefficientArraysToPropertySheetFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    internal static extern void Internal_CopySHCoefficientArraysFrom(
      MaterialPropertyBlock properties,
      SphericalHarmonicsL2[] lightProbes,
      int sourceStart,
      int destStart,
      int count);

    [ThreadSafe]
    [FreeFunction("CopyProbeOcclusionArrayToPropertySheetFromScript")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    internal static extern void Internal_CopyProbeOcclusionArrayFrom(
      MaterialPropertyBlock properties,
      Vector4[] occlusionProbes,
      int sourceStart,
      int destStart,
      int count);

    [NativeMethod(Name = "MaterialPropertyBlockScripting::Create", IsFreeFunction = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern IntPtr CreateImpl();

    [NativeMethod(Name = "MaterialPropertyBlockScripting::Destroy", IsFreeFunction = true, IsThreadSafe = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void DestroyImpl(IntPtr mpb);

    /// <summary>
    ///   <para>Is the material property block empty? (Read Only)</para>
    /// </summary>
    public extern bool isEmpty { [ThreadSafe, NativeName("IsEmpty"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void Clear(bool keepMemory);

    /// <summary>
    ///   <para>Clear material property values.</para>
    /// </summary>
    public void Clear() => this.Clear(true);

    private void SetFloatArray(int name, float[] values, int count)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      if (values.Length == 0)
        throw new ArgumentException("Zero-sized array is not allowed.");
      if (values.Length < count)
        throw new ArgumentException("array has less elements than passed count.");
      this.SetFloatArrayImpl(name, values, count);
    }

    private void SetVectorArray(int name, Vector4[] values, int count)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      if (values.Length == 0)
        throw new ArgumentException("Zero-sized array is not allowed.");
      if (values.Length < count)
        throw new ArgumentException("array has less elements than passed count.");
      this.SetVectorArrayImpl(name, values, count);
    }

    private void SetMatrixArray(int name, Matrix4x4[] values, int count)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      if (values.Length == 0)
        throw new ArgumentException("Zero-sized array is not allowed.");
      if (values.Length < count)
        throw new ArgumentException("array has less elements than passed count.");
      this.SetMatrixArrayImpl(name, values, count);
    }

    private void ExtractFloatArray(int name, List<float> values)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      values.Clear();
      int floatArrayCountImpl = this.GetFloatArrayCountImpl(name);
      if (floatArrayCountImpl <= 0)
        return;
      NoAllocHelpers.EnsureListElemCount<float>(values, floatArrayCountImpl);
      this.ExtractFloatArrayImpl(name, (float[]) NoAllocHelpers.ExtractArrayFromList((object) values));
    }

    private void ExtractVectorArray(int name, List<Vector4> values)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      values.Clear();
      int vectorArrayCountImpl = this.GetVectorArrayCountImpl(name);
      if (vectorArrayCountImpl <= 0)
        return;
      NoAllocHelpers.EnsureListElemCount<Vector4>(values, vectorArrayCountImpl);
      this.ExtractVectorArrayImpl(name, (Vector4[]) NoAllocHelpers.ExtractArrayFromList((object) values));
    }

    private void ExtractMatrixArray(int name, List<Matrix4x4> values)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      values.Clear();
      int matrixArrayCountImpl = this.GetMatrixArrayCountImpl(name);
      if (matrixArrayCountImpl <= 0)
        return;
      NoAllocHelpers.EnsureListElemCount<Matrix4x4>(values, matrixArrayCountImpl);
      this.ExtractMatrixArrayImpl(name, (Matrix4x4[]) NoAllocHelpers.ExtractArrayFromList((object) values));
    }

    public MaterialPropertyBlock() => this.m_Ptr = MaterialPropertyBlock.CreateImpl();

    ~MaterialPropertyBlock() => this.Dispose();

    private void Dispose()
    {
      if (this.m_Ptr != IntPtr.Zero)
      {
        MaterialPropertyBlock.DestroyImpl(this.m_Ptr);
        this.m_Ptr = IntPtr.Zero;
      }
      GC.SuppressFinalize((object) this);
    }

    /// <summary>
    ///   <para>This method is deprecated. Use SetFloat or SetInteger instead.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The int value to set.</param>
    public void SetInt(string name, int value)
    {
      this.SetFloatImpl(Shader.PropertyToID(name), (float) value);
    }

    /// <summary>
    ///   <para>This method is deprecated. Use SetFloat or SetInteger instead.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The int value to set.</param>
    public void SetInt(int nameID, int value) => this.SetFloatImpl(nameID, (float) value);

    /// <summary>
    ///   <para>Set a float property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The float value to set.</param>
    public void SetFloat(string name, float value)
    {
      this.SetFloatImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Set a float property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The float value to set.</param>
    public void SetFloat(int nameID, float value) => this.SetFloatImpl(nameID, value);

    /// <summary>
    ///   <para>Adds a property to the block. If an integer property with the given name already exists, the old value is replaced.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The integer value to set.</param>
    public void SetInteger(string name, int value)
    {
      this.SetIntImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Adds a property to the block. If an integer property with the given name already exists, the old value is replaced.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The integer value to set.</param>
    public void SetInteger(int nameID, int value) => this.SetIntImpl(nameID, value);

    /// <summary>
    ///   <para>Set a vector property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The Vector4 value to set.</param>
    public void SetVector(string name, Vector4 value)
    {
      this.SetVectorImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Set a vector property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The Vector4 value to set.</param>
    public void SetVector(int nameID, Vector4 value) => this.SetVectorImpl(nameID, value);

    /// <summary>
    ///   <para>Set a color property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The Color value to set.</param>
    public void SetColor(string name, Color value)
    {
      this.SetColorImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Set a color property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The Color value to set.</param>
    public void SetColor(int nameID, Color value) => this.SetColorImpl(nameID, value);

    /// <summary>
    ///   <para>Set a matrix property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The matrix value to set.</param>
    public void SetMatrix(string name, Matrix4x4 value)
    {
      this.SetMatrixImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Set a matrix property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The matrix value to set.</param>
    public void SetMatrix(int nameID, Matrix4x4 value) => this.SetMatrixImpl(nameID, value);

    /// <summary>
    ///   <para>Set a buffer property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The ComputeBuffer or GraphicsBuffer to set.</param>
    public void SetBuffer(string name, ComputeBuffer value)
    {
      this.SetBufferImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Set a buffer property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The ComputeBuffer or GraphicsBuffer to set.</param>
    public void SetBuffer(int nameID, ComputeBuffer value) => this.SetBufferImpl(nameID, value);

    /// <summary>
    ///   <para>Set a buffer property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The ComputeBuffer or GraphicsBuffer to set.</param>
    public void SetBuffer(string name, GraphicsBuffer value)
    {
      this.SetGraphicsBufferImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Set a buffer property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The ComputeBuffer or GraphicsBuffer to set.</param>
    public void SetBuffer(int nameID, GraphicsBuffer value)
    {
      this.SetGraphicsBufferImpl(nameID, value);
    }

    /// <summary>
    ///   <para>Set a texture property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The Texture to set.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public void SetTexture(string name, Texture value)
    {
      this.SetTextureImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Set a texture property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The Texture to set.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public void SetTexture(int nameID, Texture value) => this.SetTextureImpl(nameID, value);

    /// <summary>
    ///   <para>Set a texture property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The Texture to set.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public void SetTexture(string name, RenderTexture value, RenderTextureSubElement element)
    {
      this.SetRenderTextureImpl(Shader.PropertyToID(name), value, element);
    }

    /// <summary>
    ///   <para>Set a texture property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="value">The Texture to set.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public void SetTexture(int nameID, RenderTexture value, RenderTextureSubElement element)
    {
      this.SetRenderTextureImpl(nameID, value, element);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for the MaterialPropertyBlock.</para>
    /// </summary>
    /// <param name="name">The name of the constant buffer to override.</param>
    /// <param name="value">The buffer to override the constant buffer values with.</param>
    /// <param name="offset">Offset in bytes from the beginning of the buffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    /// <param name="nameID">The shader property ID of the constant buffer to override.</param>
    public void SetConstantBuffer(string name, ComputeBuffer value, int offset, int size)
    {
      this.SetConstantBufferImpl(Shader.PropertyToID(name), value, offset, size);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for the MaterialPropertyBlock.</para>
    /// </summary>
    /// <param name="name">The name of the constant buffer to override.</param>
    /// <param name="value">The buffer to override the constant buffer values with.</param>
    /// <param name="offset">Offset in bytes from the beginning of the buffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    /// <param name="nameID">The shader property ID of the constant buffer to override.</param>
    public void SetConstantBuffer(int nameID, ComputeBuffer value, int offset, int size)
    {
      this.SetConstantBufferImpl(nameID, value, offset, size);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for the MaterialPropertyBlock.</para>
    /// </summary>
    /// <param name="name">The name of the constant buffer to override.</param>
    /// <param name="value">The buffer to override the constant buffer values with.</param>
    /// <param name="offset">Offset in bytes from the beginning of the buffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    /// <param name="nameID">The shader property ID of the constant buffer to override.</param>
    public void SetConstantBuffer(string name, GraphicsBuffer value, int offset, int size)
    {
      this.SetConstantGraphicsBufferImpl(Shader.PropertyToID(name), value, offset, size);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for the MaterialPropertyBlock.</para>
    /// </summary>
    /// <param name="name">The name of the constant buffer to override.</param>
    /// <param name="value">The buffer to override the constant buffer values with.</param>
    /// <param name="offset">Offset in bytes from the beginning of the buffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    /// <param name="nameID">The shader property ID of the constant buffer to override.</param>
    public void SetConstantBuffer(int nameID, GraphicsBuffer value, int offset, int size)
    {
      this.SetConstantGraphicsBufferImpl(nameID, value, offset, size);
    }

    public void SetFloatArray(string name, List<float> values)
    {
      this.SetFloatArray(Shader.PropertyToID(name), NoAllocHelpers.ExtractArrayFromListT<float>(values), values.Count);
    }

    public void SetFloatArray(int nameID, List<float> values)
    {
      this.SetFloatArray(nameID, NoAllocHelpers.ExtractArrayFromListT<float>(values), values.Count);
    }

    /// <summary>
    ///   <para>Set a float array property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="values">The array to set.</param>
    public void SetFloatArray(string name, float[] values)
    {
      this.SetFloatArray(Shader.PropertyToID(name), values, values.Length);
    }

    /// <summary>
    ///   <para>Set a float array property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="values">The array to set.</param>
    public void SetFloatArray(int nameID, float[] values)
    {
      this.SetFloatArray(nameID, values, values.Length);
    }

    public void SetVectorArray(string name, List<Vector4> values)
    {
      this.SetVectorArray(Shader.PropertyToID(name), NoAllocHelpers.ExtractArrayFromListT<Vector4>(values), values.Count);
    }

    public void SetVectorArray(int nameID, List<Vector4> values)
    {
      this.SetVectorArray(nameID, NoAllocHelpers.ExtractArrayFromListT<Vector4>(values), values.Count);
    }

    /// <summary>
    ///   <para>Set a vector array property.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="values">The array to set.</param>
    /// <param name="name">The name of the property.</param>
    public void SetVectorArray(string name, Vector4[] values)
    {
      this.SetVectorArray(Shader.PropertyToID(name), values, values.Length);
    }

    /// <summary>
    ///   <para>Set a vector array property.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="values">The array to set.</param>
    /// <param name="name">The name of the property.</param>
    public void SetVectorArray(int nameID, Vector4[] values)
    {
      this.SetVectorArray(nameID, values, values.Length);
    }

    public void SetMatrixArray(string name, List<Matrix4x4> values)
    {
      this.SetMatrixArray(Shader.PropertyToID(name), NoAllocHelpers.ExtractArrayFromListT<Matrix4x4>(values), values.Count);
    }

    public void SetMatrixArray(int nameID, List<Matrix4x4> values)
    {
      this.SetMatrixArray(nameID, NoAllocHelpers.ExtractArrayFromListT<Matrix4x4>(values), values.Count);
    }

    /// <summary>
    ///   <para>Set a matrix array property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="values">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="nameID">The array to set.</param>
    public void SetMatrixArray(string name, Matrix4x4[] values)
    {
      this.SetMatrixArray(Shader.PropertyToID(name), values, values.Length);
    }

    /// <summary>
    ///   <para>Set a matrix array property.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="values">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="nameID">The array to set.</param>
    public void SetMatrixArray(int nameID, Matrix4x4[] values)
    {
      this.SetMatrixArray(nameID, values, values.Length);
    }

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the property with the given name or name ID. To set the property, use one of the Set methods for MaterialPropertyBlock.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasProperty(string name) => this.HasPropertyImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the property with the given name or name ID. To set the property, use one of the Set methods for MaterialPropertyBlock.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasProperty(int nameID) => this.HasPropertyImpl(nameID);

    /// <summary>
    ///   <para>This method is deprecated. Use HasFloat or HasInteger instead.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasInt(string name) => this.HasFloatImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>This method is deprecated. Use HasFloat or HasInteger instead.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasInt(int nameID) => this.HasFloatImpl(nameID);

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Float property with the given name or name ID. To set the property, use SetFloat.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasFloat(string name) => this.HasFloatImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Float property with the given name or name ID. To set the property, use SetFloat.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasFloat(int nameID) => this.HasFloatImpl(nameID);

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Integer property with the given name or name ID. To set the property, use SetInteger.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasInteger(string name) => this.HasIntImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Integer property with the given name or name ID. To set the property, use SetInteger.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasInteger(int nameID) => this.HasIntImpl(nameID);

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Texture property with the given name or name ID. To set the property, use SetTexture.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasTexture(string name) => this.HasTextureImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Texture property with the given name or name ID. To set the property, use SetTexture.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasTexture(int nameID) => this.HasTextureImpl(nameID);

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Matrix property with the given name or name ID. This also works with the Matrix Array property. To set the property, use SetMatrix.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasMatrix(string name) => this.HasMatrixImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Matrix property with the given name or name ID. This also works with the Matrix Array property. To set the property, use SetMatrix.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasMatrix(int nameID) => this.HasMatrixImpl(nameID);

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Vector property with the given name or name ID. This also works with the Vector Array property. To set the property, use SetVector.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasVector(string name) => this.HasVectorImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Vector property with the given name or name ID. This also works with the Vector Array property. To set the property, use SetVector.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasVector(int nameID) => this.HasVectorImpl(nameID);

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Color property with the given name or name ID. To set the property, use SetColor.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasColor(string name) => this.HasVectorImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the Color property with the given name or name ID. To set the property, use SetColor.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasColor(int nameID) => this.HasVectorImpl(nameID);

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the ComputeBuffer property with the given name or name ID. To set the property, use SetBuffer.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <param name="name">The name of the property.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasBuffer(string name) => this.HasBufferImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the ComputeBuffer property with the given name or name ID. To set the property, use SetBuffer.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <param name="name">The name of the property.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasBuffer(int nameID) => this.HasBufferImpl(nameID);

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the ConstantBuffer property with the given name or name ID. To set the property, use SetConstantBuffer.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasConstantBuffer(string name)
    {
      return this.HasConstantBufferImpl(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>Checks if MaterialPropertyBlock has the ConstantBuffer property with the given name or name ID. To set the property, use SetConstantBuffer.</para>
    /// </summary>
    /// <param name="name">The name of the property.</param>
    /// <param name="nameID">The name ID of the property. Use Shader.PropertyToID to get this ID.</param>
    /// <returns>
    ///   <para>Returns true if MaterialPropertyBlock has this property.</para>
    /// </returns>
    public bool HasConstantBuffer(int nameID) => this.HasConstantBufferImpl(nameID);

    /// <summary>
    ///   <para>Get a float from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public float GetFloat(string name) => this.GetFloatImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Get a float from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public float GetFloat(int nameID) => this.GetFloatImpl(nameID);

    /// <summary>
    ///   <para>This method is deprecated. Use GetFloat or GetInteger instead.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public int GetInt(string name) => (int) this.GetFloatImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>This method is deprecated. Use GetFloat or GetInteger instead.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public int GetInt(int nameID) => (int) this.GetFloatImpl(nameID);

    /// <summary>
    ///   <para>Get an integer from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public int GetInteger(string name) => this.GetIntImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Get an integer from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public int GetInteger(int nameID) => this.GetIntImpl(nameID);

    /// <summary>
    ///   <para>Get a vector from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Vector4 GetVector(string name) => this.GetVectorImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Get a vector from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Vector4 GetVector(int nameID) => this.GetVectorImpl(nameID);

    /// <summary>
    ///   <para>Get a color from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Color GetColor(string name) => this.GetColorImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Get a color from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Color GetColor(int nameID) => this.GetColorImpl(nameID);

    /// <summary>
    ///   <para>Get a matrix from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Matrix4x4 GetMatrix(string name) => this.GetMatrixImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Get a matrix from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Matrix4x4 GetMatrix(int nameID) => this.GetMatrixImpl(nameID);

    /// <summary>
    ///   <para>Get a texture from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Texture GetTexture(string name) => this.GetTextureImpl(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Get a texture from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Texture GetTexture(int nameID) => this.GetTextureImpl(nameID);

    /// <summary>
    ///   <para>Get a float array from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public float[] GetFloatArray(string name) => this.GetFloatArray(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Get a float array from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public float[] GetFloatArray(int nameID)
    {
      return this.GetFloatArrayCountImpl(nameID) != 0 ? this.GetFloatArrayImpl(nameID) : (float[]) null;
    }

    /// <summary>
    ///   <para>Get a vector array from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Vector4[] GetVectorArray(string name) => this.GetVectorArray(Shader.PropertyToID(name));

    /// <summary>
    ///   <para>Get a vector array from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Vector4[] GetVectorArray(int nameID)
    {
      return this.GetVectorArrayCountImpl(nameID) != 0 ? this.GetVectorArrayImpl(nameID) : (Vector4[]) null;
    }

    /// <summary>
    ///   <para>Get a matrix array from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Matrix4x4[] GetMatrixArray(string name)
    {
      return this.GetMatrixArray(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>Get a matrix array from the property block.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public Matrix4x4[] GetMatrixArray(int nameID)
    {
      return this.GetMatrixArrayCountImpl(nameID) != 0 ? this.GetMatrixArrayImpl(nameID) : (Matrix4x4[]) null;
    }

    public void GetFloatArray(string name, List<float> values)
    {
      this.ExtractFloatArray(Shader.PropertyToID(name), values);
    }

    public void GetFloatArray(int nameID, List<float> values)
    {
      this.ExtractFloatArray(nameID, values);
    }

    public void GetVectorArray(string name, List<Vector4> values)
    {
      this.ExtractVectorArray(Shader.PropertyToID(name), values);
    }

    public void GetVectorArray(int nameID, List<Vector4> values)
    {
      this.ExtractVectorArray(nameID, values);
    }

    public void GetMatrixArray(string name, List<Matrix4x4> values)
    {
      this.ExtractMatrixArray(Shader.PropertyToID(name), values);
    }

    public void GetMatrixArray(int nameID, List<Matrix4x4> values)
    {
      this.ExtractMatrixArray(nameID, values);
    }

    public void CopySHCoefficientArraysFrom(List<SphericalHarmonicsL2> lightProbes)
    {
      if (lightProbes == null)
        throw new ArgumentNullException(nameof (lightProbes));
      this.CopySHCoefficientArraysFrom(NoAllocHelpers.ExtractArrayFromListT<SphericalHarmonicsL2>(lightProbes), 0, 0, lightProbes.Count);
    }

    /// <summary>
    ///   <para>This function converts and copies the entire source array into 7 Vector4 property arrays named unity_SHAr, unity_SHAg, unity_SHAb, unity_SHBr, unity_SHBg, unity_SHBb and unity_SHC for use with instanced rendering.</para>
    /// </summary>
    /// <param name="lightProbes">The array of SH values to copy from.</param>
    public void CopySHCoefficientArraysFrom(SphericalHarmonicsL2[] lightProbes)
    {
      if (lightProbes == null)
        throw new ArgumentNullException(nameof (lightProbes));
      this.CopySHCoefficientArraysFrom(lightProbes, 0, 0, lightProbes.Length);
    }

    public void CopySHCoefficientArraysFrom(
      List<SphericalHarmonicsL2> lightProbes,
      int sourceStart,
      int destStart,
      int count)
    {
      this.CopySHCoefficientArraysFrom(NoAllocHelpers.ExtractArrayFromListT<SphericalHarmonicsL2>(lightProbes), sourceStart, destStart, count);
    }

    /// <summary>
    ///   <para>This function converts and copies the source array into 7 Vector4 property arrays named unity_SHAr, unity_SHAg, unity_SHAb, unity_SHBr, unity_SHBg, unity_SHBb and unity_SHC with the specified source and destination range for use with instanced rendering.</para>
    /// </summary>
    /// <param name="lightProbes">The array of SH values to copy from.</param>
    /// <param name="sourceStart">The index of the first element in the source array to copy from.</param>
    /// <param name="destStart">The index of the first element in the destination MaterialPropertyBlock array to copy to.</param>
    /// <param name="count">The number of elements to copy.</param>
    public void CopySHCoefficientArraysFrom(
      SphericalHarmonicsL2[] lightProbes,
      int sourceStart,
      int destStart,
      int count)
    {
      if (lightProbes == null)
        throw new ArgumentNullException(nameof (lightProbes));
      if (sourceStart < 0)
        throw new ArgumentOutOfRangeException(nameof (sourceStart), "Argument sourceStart must not be negative.");
      if (destStart < 0)
        throw new ArgumentOutOfRangeException(nameof (sourceStart), "Argument destStart must not be negative.");
      if (count < 0)
        throw new ArgumentOutOfRangeException(nameof (count), "Argument count must not be negative.");
      if (lightProbes.Length < sourceStart + count)
        throw new ArgumentOutOfRangeException("The specified source start index or count is out of the range.");
      MaterialPropertyBlock.Internal_CopySHCoefficientArraysFrom(this, lightProbes, sourceStart, destStart, count);
    }

    public void CopyProbeOcclusionArrayFrom(List<Vector4> occlusionProbes)
    {
      if (occlusionProbes == null)
        throw new ArgumentNullException(nameof (occlusionProbes));
      this.CopyProbeOcclusionArrayFrom(NoAllocHelpers.ExtractArrayFromListT<Vector4>(occlusionProbes), 0, 0, occlusionProbes.Count);
    }

    /// <summary>
    ///   <para>This function copies the entire source array into a Vector4 property array named unity_ProbesOcclusion for use with instanced rendering.</para>
    /// </summary>
    /// <param name="occlusionProbes">The array of probe occlusion values to copy from.</param>
    public void CopyProbeOcclusionArrayFrom(Vector4[] occlusionProbes)
    {
      if (occlusionProbes == null)
        throw new ArgumentNullException(nameof (occlusionProbes));
      this.CopyProbeOcclusionArrayFrom(occlusionProbes, 0, 0, occlusionProbes.Length);
    }

    public void CopyProbeOcclusionArrayFrom(
      List<Vector4> occlusionProbes,
      int sourceStart,
      int destStart,
      int count)
    {
      this.CopyProbeOcclusionArrayFrom(NoAllocHelpers.ExtractArrayFromListT<Vector4>(occlusionProbes), sourceStart, destStart, count);
    }

    /// <summary>
    ///   <para>This function copies the source array into a Vector4 property array named unity_ProbesOcclusion with the specified source and destination range for use with instanced rendering.</para>
    /// </summary>
    /// <param name="occlusionProbes">The array of probe occlusion values to copy from.</param>
    /// <param name="sourceStart">The index of the first element in the source array to copy from.</param>
    /// <param name="destStart">The index of the first element in the destination MaterialPropertyBlock array to copy to.</param>
    /// <param name="count">The number of elements to copy.</param>
    public void CopyProbeOcclusionArrayFrom(
      Vector4[] occlusionProbes,
      int sourceStart,
      int destStart,
      int count)
    {
      if (occlusionProbes == null)
        throw new ArgumentNullException(nameof (occlusionProbes));
      if (sourceStart < 0)
        throw new ArgumentOutOfRangeException(nameof (sourceStart), "Argument sourceStart must not be negative.");
      if (destStart < 0)
        throw new ArgumentOutOfRangeException(nameof (sourceStart), "Argument destStart must not be negative.");
      if (count < 0)
        throw new ArgumentOutOfRangeException(nameof (count), "Argument count must not be negative.");
      if (occlusionProbes.Length < sourceStart + count)
        throw new ArgumentOutOfRangeException("The specified source start index or count is out of the range.");
      MaterialPropertyBlock.Internal_CopyProbeOcclusionArrayFrom(this, occlusionProbes, sourceStart, destStart, count);
    }

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void GetVectorImpl_Injected(int name, out Vector4 ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void GetColorImpl_Injected(int name, out Color ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void GetMatrixImpl_Injected(int name, out Matrix4x4 ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetVectorImpl_Injected(int name, ref Vector4 value);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetColorImpl_Injected(int name, ref Color value);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetMatrixImpl_Injected(int name, ref Matrix4x4 value);
  }
}
